<!-- include tpl=head_lay -->
<script type="text/javascript">
function edit_it(id)
{
	var url = get_url('task','save','id='+id);
	var lock = $.dialog.tips('正在提交中，请稍候…',100).lock();
	$.phpok.submit($("#update_"+id)[0],url,function(rs){
		if(!rs.status){
			lock.content(rs.info).time(2);
			return false;
		}
		if(id>0){
			lock.content('修改成功').time(2);
			return true;
		}
		lock.setting('close',function(){
			$.phpok.reload();
		});
		lock.content('添加成功').time(2);
		return true;
	});
	return false;
}
function delete_id(id)
{
	var url = get_url('task','delete','id='+id);
	var lock = $.dialog.tips('正在提交中，请稍候…',100).lock();
	$.phpok.json(url,function(rs){
		if(!rs.status){
			lock.content(rs.info).time(2);
			return false;
		}
		$("#delete_"+id).remove();
		lock.content('删除成功').time(1);
	});
}
</script>
<div class="layui-card">
	<div class="layui-card-body">
		<table class="layui-table">
		<thead>
		<tr>
			<th>{lang年}</th>
			<th>{lang月}</th>
			<th>{lang日}</th>
			<th>{lang时}</th>
			<th>{lang分}</th>
			<th>{lang秒}</th>
			<th>{lang动作}</th>
			<th>{lang参数}</th>
			<th>{lang操作}</th>
		</tr>
		</thead>
		<!-- loop from=$rslist key=$key value=$value -->
		<tr id="delete_{$value.id}">
			<form method="post" class="layui-form" id="update_{$value.id}" onsubmit="return false;">
			<td>
				<select name="year">
				<option value="*">每年</option>
				<!-- loop from=$yearlist key=$k value=$v id=$tmpid -->
				<option value="{$v}"{if $v == $value.year && $value.year != '*'} selected{/if}>{$v}年</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="month">
				<option value="*">每月</option>
				<!-- loop from=$monthlist key=$k value=$v id=$tmpid -->
				<option value="{$v}"{if $v == $value.month && $value.month != '*'} selected{/if}>{$v}月</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="day">
				<option value="*">每天</option>
				<!-- loop from=$daylist key=$k value=$v id=$tmpid -->
				<option value="{$v}"{if $v == $value.day && $value.day != '*'} selected{/if}>{$v}日</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="hour">
				<option value="*">每小时</option>
				<!-- loop from=$hourlist key=$k value=$v id=$tmpid -->
				<option value="{$v}"{if $v == $value.hour && $value.hour != '*'} selected{/if}>{$v}时</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="minute">
				<option value="*">每分钟</option>
				<!-- loop from=$minutelist key=$k value=$v id=$tmpid -->
				<option value="{$v}"{if $v == $value.minute && $value.minute != '*'} selected{/if}>{$v}分</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="second">
					<!-- loop from=$seclist key=$k value=$v id=$tmpid -->
					<option value="{$v}"{if $v == $value.second && $value.second != '*'} selected{/if}>每 {$v} 秒</option>
					<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="actionfile">
				<option value="">{lang请选择…}</option>
				<!-- loop from=$filelist key=$k value=$v id=$tmpid -->
				<option value="{$v.id}"{if $v.id == $value.action} selected{/if}>{$v.txt} - {$v.id}</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<input type="text" name="param" value="{$value.param}" />
			</td>
			<td>
				<div class="layui-btn-group">
					<input type="button" value="{lang编辑}" onclick="edit_it('{$value.id}')" class="layui-btn layui-btn-sm" />
					<input type="button" value="{lang删除}" onclick="delete_id('{$value.id}')" class="layui-btn layui-btn-sm layui-btn-danger" />
				</div>
			</td>
			</form>
		</tr>
		<!-- /loop -->
		<tr>
			<form method="post" class="layui-form" id="update_0" onsubmit="return false;">
			<td>
				<select name="year">
				<option value="*">{lang每年}</option>
				<!-- loop from=$yearlist key=$k value=$v id=$tmpid -->
				<option value="{$v}">{$v}{lang年}</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="month">
				<option value="*">{lang每月}</option>
				<!-- loop from=$monthlist key=$k value=$v id=$tmpid -->
				<option value="{$v}">{$v}{lang月}</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="day">
				<option value="*">每天</option>
				<!-- loop from=$daylist key=$k value=$v id=$tmpid -->
				<option value="{$v}">{$v}日</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="hour">
				<option value="*">{lang每小时}</option>
				<!-- loop from=$hourlist key=$k value=$v id=$tmpid -->
				<option value="{$v}">{$v}{lang时}</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="minute">
				<option value="*">每分钟</option>
				<!-- loop from=$minutelist key=$k value=$v id=$tmpid -->
				<option value="{$v}">{$v}{lang分}</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="second">
					<!-- loop from=$seclist key=$k value=$v id=$tmpid -->
					<option value="{$v}">每 {$v} 秒</option>
					<!-- /loop -->
				</select>
			</td>
			<td>
				<select name="actionfile">
				<option value="">{lang请选择…}</option>
				<!-- loop from=$filelist key=$k value=$v id=$tmpid -->
				<option value="{$v.id}">{$v.txt}_{$v.id}</option>
				<!-- /loop -->
				</select>
			</td>
			<td>
				<input type="text" name="param" value="" />
			</td>
			<td>
				<input type="button" value="{lang新增}" onclick="edit_it(0)" class="layui-btn layui-btn-sm" />
			</td>
			</form>
		</tr>
		</table>

	</div>
</div>
<!-- include tpl=foot_lay -->